@extends('admin.layout')
@section('title',$title)
@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                商品管理
                <small>商品列表</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i>后台首页</a></li>
                <li><a href="#">商品管理</a></li>
                <li class="active">商品列表</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">商品列表</h3>
                        </div><!-- /.box-header -->
                        <div class="box-body">
                            <form action="/admin/goods/index" method="get">

                            @if(session('success'))
                                <div class="alert alert-danger">
                                    {{session('success')}}
                                </div>
                            @endif
                            <div class="form-group">
                                <div class="row">
                                    <div class="col-md-2">
                                         <select name="num" class="form-control">
                                            <option
                                                @if(!empty($request['num']) && $request['num'] == 10)
                                                    selected
                                                @endif
                                            >10</option>
                                            <option
                                                @if(!empty($request['num']) && $request['num'] == 20)
                                                    selected
                                                @endif
                                            >20</option>
                                            <option
                                                @if(!empty($request['num']) && $request['num'] == 50)
                                                    selected
                                                @endif
                                            >50</option>
                                            <option
                                                @if(!empty($request['num']) && $request['num'] == 100)
                                                    selected
                                                @endif
                                            >100</option>
                                            <option
                                                @if(!empty($request['num']) && $request['num'] == 150)
                                                    selected
                                                @endif
                                            >150</option>
                                        </select>
                                    </div>
                                    <div class="col-md-2 col-md-offset-8">
                                        <div class="input-group input-group-sm">
                                            <input value="{{$request['keywords'] or ''}}" name="keywords" type="text" class="form-control">
                                            <span class="input-group-btn">
                                                <button class="btn btn-info btn-flat">搜索</button>
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            </form>
                            <table id="example2" class="table table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>商品ID</th>
                                    <th>商品名称</th>
                                    <th>商品logo</th>
                                    <th>商品描述</th>
                                    <th>商品价格</th>
                                    <th>商品货号</th>
                                    <th>商品板块</th>
                                    <th>商品类目</th>
                                    <th>状态</th>
                                    <th>销量</th>
                                    <th>商品库存</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($data as $goods)
                                <tr>
                                    <td>{{$goods-> id}}</td>
                                    <td style="width: 200px;">{{$goods -> goodsname}}</td>
                                    <td><img src="{{$goods -> logo}}" width="50px"></td>
                                    <td>{{$goods -> description}}</td>
                                    <td>{{$goods -> value}}</td>
                                    <td>{{$goods -> mark}}</td>
                                    <td>{{$goods -> name}}</td>
                                    <td>{{$goods -> type}}</td>
                                    <td>
                                        @if($goods -> status ==1)
                                            在售
                                        @else
                                            下架
                                        @endif
                                    </td>
                                    <td>{{$goods -> inventory}}</td>
                                    <td>{{$goods -> sellnum}}</td>
                                    <td><a href="/admin/goods/edit/{{$goods->id}}">编辑</a>  <a href="/admin/goods/delete/{{$goods->id}}">删除</a></td>
                                </tr>
                                @endforeach
                                </tbody>
                            </table>
                            {!! $data->appends($request)->render() !!}
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection